txd = engineLoadTXD ("Heros-WielkaStopa.txd")
engineImportTXD (txd, 132)
dff = engineLoadDFF ("Heros-WielkaStopa.dff")
engineReplaceModel (dff, 132)

txd = engineLoadTXD ("Heros-PiesPunkto.txd")
engineImportTXD (txd, 133)
dff = engineLoadDFF ("Heros-PiesPunkto.dff")
engineReplaceModel (dff, 133)

txd = engineLoadTXD ("Heros-ZabojczyKrolik.txd")
engineImportTXD (txd, 134)
dff = engineLoadDFF ("Heros-ZabojczyKrolik.dff")
engineReplaceModel (dff, 134)

txd = engineLoadTXD ("Heros-StraznikPystyniKhazix.txd")
engineImportTXD (txd, 135)
dff = engineLoadDFF ("Heros-StraznikPystyniKhazix.dff")
engineReplaceModel (dff, 135)

txd = engineLoadTXD ("Heros-HandlarzMirek.txd")
engineImportTXD (txd, 136)
dff = engineLoadDFF ("Heros-HandlarzMirek.dff")
engineReplaceModel (dff, 136)

loadstring(exports.dgs:dgsImportFunction())()
local sw,sh = guiGetScreenSize()
local px,py = sw/1366,sh/768
font = dgsCreateFont( ":cmta-pobieraniezasobow/OSB.ttf", 16*px )



for i,v in pairs(getElementsByType("ped")) do
    if getElementData(v,"Heros") then
        local x,y,z = getElementPosition(v)
        text = dgsCreate3DText(x,y,z,getElementData(v,"Heros"),tocolor(153,50,204,255),font,0.4,0.4,25,true)
        setElementData(v,"textHeros",text)
        dgs3DTextAttachToElement(text,v,0,0,tonumber(getElementData(v,"HerosTextHeight")))
    end
end

addEvent("cmta_herosi:usuntext", true)
addEventHandler("cmta_herosi:usuntext", root, function(ped)
    destroyElement(getElementData(ped,"textHeros"))
end)

--[[
addEvent("cmta_herosi:wrocnaresp", true)
addEventHandler("cmta_herosi:wrocnaresp", root, function(ped)
    setElementPosition(ped,getElementData(ped,"HerosResp")[1],getElementData(ped,"HerosResp")[2],getElementData(ped,"HerosResp")[3])
end)]]

addEvent("cmta_herosi:stworztext", true)
addEventHandler("cmta_herosi:stworztext", root, function(ped)
    local x,y,z = getElementPosition(ped)
    text = dgsCreate3DText(x,y,z,getElementData(ped,"Heros"),tocolor(153,50,204,255),font,0.4,0.4,25,true)
    setElementData(ped,"textHeros",text)
    dgs3DTextAttachToElement(text,ped,0,0,tonumber(getElementData(ped,"HerosTextHeight")))
end)

addCommandHandler("gp2",function()
    local x,y,z = getElementPosition(localPlayer)
    local xr,yr,zr = getElementRotation(localPlayer)
    p=string.format("%.2f,%.2f,%.2f,%.2f,%.2f,%.2f",x,y,z,xr,yr,zr)
    setClipboard(p)
end)

